package com.demo.fullink.api;

import com.demo.fullink.service.OrderService;
import com.demo.fullink.service.StorageOrderService;
import com.demo.fullink.service.StorageProductService;
import com.demo.fulllink.module.vo.OrderVO;
import com.demo.fulllink.module.vo.ResponseVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/orderapi")
public class OrderAPIController {
    
    private Logger log = LoggerFactory.getLogger(OrderAPIController.class);
    @Autowired
    private OrderService orderService;
    
    @Autowired
    private StorageOrderService storageOrderService;
    
    @Autowired
    private StorageProductService storageProductService;
    
    /**
     * 下单接口
     *
     * @param orderVO
     */
    @RequestMapping("/placeOrder")
    public ResponseVO placeOrder(@RequestBody OrderVO orderVO) {
        log.info("order 服务 下单开始");
        return orderService.placeOrder(orderVO);
    }
    
    @RequestMapping("/queryOrder/{orderid}")
    public ResponseVO queryOrder(@PathVariable("orderid") String orderid) {
        return orderService.findOrder(orderid);
    }
    
}
